package com.example.demo.service;

import com.example.demo.mapper.StudentMapper;
import com.example.demo.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentService {
    @Autowired
    private StudentMapper studentMapper;

    public Student getStudentById(Long id){
        return studentMapper.findById(id);
    }

    public List<Student>  list(){
        return studentMapper.findAll();
    }

    public int insert(Student student){
        return studentMapper.insert(student);
    }
    public int deleteById(Long id){
        return studentMapper.deleteById(id);
    }
    public int update(Student student){
        return studentMapper.update(student);
    }
    public int updateWithId(Long id,Student student){
        return studentMapper.updateWithId(id,student);
    }
}
